<template>
	<view class="goods_Box">
		<view class="goods_list_item" v-for="(item,index) in list" :key="index">
			<!-- <view class="date">
				<image src="@/static/detail/titles.png" mode="widthFix"></image>
				<text>{{item.date}}</text>
				<image src="@/static/detail/titles1.png" mode="widthFix"></image>
			</view> -->
			<view class="main"  v-for="(val,i) in item.list" :key="i">
				<view class="timer">
					<view class="flCont">
						<image src="@/static/home/icon1.png" mode="widthFix"></image>
						<text>火热预算中</text>
					</view>
					<view class="frCont">{{item.date +" "+ setDate(val.startTime)+" 发售"}}</view>
				</view>
				
				<view class="content">
					<view class="show_img">
						<view v-if="isImage(val.fileUrl) == 'mp4'">
							<image class="img" :src="pathImg+val.fileUrl+'?x-oss-process=video/snapshot,t_0,f_jpg'" mode="widthFix"></image>
						</view>
						<view v-else-if="isImage(val.fileUrl) == 'mp3'">
							<audio class="audioBox" :src="pathImg+val.fileUrl" :controls="true"></audio>
						</view>
						<view v-else>
							<!-- <image class="img" :src="pathImg+val.fileUrl+'?x-oss-process=image/format,png'" mode="widthFix"> -->
							<image class="img" :src="pathImg+val.fileUrl" mode="widthFix">
							</image>
						</view>
					</view>
					<view class="goods_desc">
						<view class="title">
							<text>{{val.seriesName}}</text>
							<image v-if="setImgShow(val) == 1" src="@/static/home/fileType1.png" mode="widthFix"></image>
							<image v-if="setImgShow(val) == 2" src="@/static/home/fileType2.png" mode="widthFix"></image>
							<image v-if="setImgShow(val) == 3" src="@/static/home/fileType3.png" mode="widthFix"></image>
						</view>
						<view class="number">
							<view>限量<text class="text">{{val.castingAmount?val.castingAmount:"1"}}份</text></view>
							<view v-for="(cur,ind) in val.labelList" :key="ind">{{cur}}</view>
						</view>
						<view class="price"><text>￥</text>{{val.price}}</view>
						<view class="author">
							<image :src="val.issuerHead[0]" mode="widthFix"></image>
							<text>{{val.issuerName[0]}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="msg" v-if="isEnd && index == list.length-1">— 更多内容敬请期待 —</view>
		</view>
	</view>
	
</template>

<script>
	export default {
		props:{
			list:{
				type:Array,
				default:[]
			},
			isEnd:{
				type:Boolean,
				default:false
			}
		},
		data() {
			return {
				
			}
		},
		methods:{
			setImgShow(cur){
				if(cur.metafile.FileType){
					if(cur.metafile.FileType == ".glb"){
						return 3;
					}else if(cur.metafile.FileType == ".mp4"){
						return 2;
					}else{
						return 1;
					}
				}
				return 0;
			},
			setDate(n){//设置时间
				let timer="";
				let date = new Date(n);
				let y = date.getFullYear();
				let m = date.getMonth()+1;
				let d = date.getDate();
				let h = date.getHours();
				let mm = date.getMinutes();
				timer = add0(h)+':'+add0(mm);
				function add0(m){
					return m<10?'0'+m:m 
				}
				return timer;
			},
			// 判断藏品是否是图片
			isImage(url) {
				if (url) {
					let filePath = url.toLocaleLowerCase();
					if (filePath.indexOf(".mp4") != -1) {
						return 'mp4';
					} else if (filePath.indexOf(".mp3") != -1) {
						return 'mp3';
					} else {
						return 'img';
					}
				}
			},
			navTo(url, index,i) {
				uni.navigateTo({
					url,
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.goods_Box{
		padding-bottom: 30upx;
		.goods_list_item {
			width: 100%;
			position: relative;
			overflow: hidden;
			padding: 0 30upx;
			color: #fff;
			.date{
				display: flex;
				justify-content: center;
				align-items: center;
				margin-bottom:30upx;
				image{
					width:100upx;
				}
				text{
					font-size: 28upx;
					color:#fff;
					display:inline-block;
					width:200upx;
					text-align:center;
				}
			}
			.main {
				background-color: #fff;
				border-radius: 25upx;
				padding-top: 14upx;
				margin-bottom: 30upx;
				.timer{
					font-size: 30upx;
					line-height: 36upx;
					margin-bottom: 10upx;
					padding: 0 20upx;
					display: flex;
					align-items: flex-end;
					justify-content: space-between;
					height: 48upx;
					.flCont{
						display: flex;
						align-items: flex-end;
						color: #EB5703;
					}
					.frCont{
						color: #2E1A6B;
					}
					image{
						width: 48upx;
					}
				}
				.content{
					display: flex;
					align-items: center;
					flex-wrap: wrap;
					overflow: hidden;
					.show_img{
						width: 100%;
						height: 320upx;
						>view{
							width: 100%;
							height: 100%;
							border-radius: 20upx;
							overflow: hidden;
							display: flex;
							align-items: center;
							justify-content: center;
							.img,.audioBox{
								width: 100%;
							}
					
						}
					}
					.goods_desc{
						width: 100%;
						text-align: left;
						padding:0 20upx;
						padding-bottom: 35upx;
						position: relative;
						.title{
							display: flex;
							align-items: center;
							justify-content: space-between;
							padding-top: 20upx;
							padding-bottom: 58upx;
							image{
								width: 26upx;
							}
							text {
								flex: 1%;
								padding-right: 16upx;
								font-size: 30upx;
								line-height: 30upx;
								height: 30upx;
								font-family: PingFang SC;
								font-weight: bold;
								color: #222;
								overflow: hidden;
								white-space: nowrap;
								text-overflow: ellipsis;
								-o-text-overflow:ellipsis;
							}
						}
						.number{
							width: 90%;
							display: flex;
							justify-content: flex-start;
							flex-wrap: wrap;
							font-size: 0;
							margin-bottom: 2upx;
							view{
								display: flex;
								align-items: center;
								justify-content: center;
								height: 100%;
								background: #f3f1f1;
								// color: #2E1A6B;
								color: rgba($color:#2E1A6B,$alpha:0.41);
								font-size: 24upx;
								text-align: center;
								line-height: 32upx;
								padding: 0 15upx;
								margin-right: 30upx;
								margin-bottom: 20upx;
								.text{
									color: #EB5703;
									display: inline-block;
									height: 100%;
									margin-left: 16upx;
								}
							}
							
						}
						.author{
							display: flex;
							align-items: center;
							justify-content: flex-start;
							image{
								border-radius: 50%;
								width: 36upx;
								height: 36upx;
								box-shadow: 0 0 6px 3px rgba(0,0,0,0.1);
							}
							text{
								color: #848C9B;
								font-size: 24upx;
								margin-left: 8upx;
							}
						}
						.price{
							font-size: 50upx;
							line-height:48upx;
							height: 124upx;
							min-width: 228upx;
							position: absolute;
							bottom: 0;
							right: 0;
							border-bottom-right-radius: 25upx;
							background-image: url("../../../static/home/icon2.png");
							background-size: 100% 100%;
							background-repeat: no-repeat;
							display: flex;
							justify-content: center;
							align-items: flex-end;
							padding: 0 10upx;
							padding-left: 56upx;
							padding-bottom: 38upx;
							text{
								line-height:30upx;
								font-size: 30upx;
							}
						}
					}
				}
			}
		
		}
		.msg {
			text-align: center;
			color: #333;
			font-size: 24upx;
			margin-top: 30upx;
			// padding-bottom: 100upx;
		}
	}
</style>
